<template>
    <el-dialog
            :title="digQuery.title"
            custom-class="dialogBox channelListDialog"
            :visible.sync="dialogVisible"
            v-if="dialogVisible"
            :close-on-click-modal="false"
            @close="close"
            :width="digQuery.width">
        <div>
            <slot></slot>
        </div>
        <span slot="footer" class="dialog-footer">
            <el-button @click="dialogVisible = false;close()" class="el-button-primary-no">取&nbsp;&nbsp;消</el-button>
            <el-button type="primary" class="el-button-primary-style marginLeft8" v-if="!isDisabled" :disabled="isDisabled" @click="save" :loading="disabled">确&nbsp;&nbsp;定</el-button>
        </span>
    </el-dialog>
</template>

<script>
    export default {
        name: "EdDig",
        props:{
            digQuery:{
                type:Object,
                required: false,
                default: function () {
                    return {width: "600px",title:""};
                }
            }
        },
        data(){
            return{
                dialogVisible:false,
                form:{},
                disabled:false,
                isDisabled:false
            }
        },
        methods:{
            show(isDisabled){
                this.isDisabled = isDisabled;
                this.dialogVisible = true
            },
            hide(){
                this.disabled = false;
                this.$emit("on-close",true);
                this.dialogVisible = false
            },
            loadingFn(data){
                this.disabled = data
            },
            resetFields(){

            },
            save(){
                this.disabled = true;
                this.$emit("on-save",true);
            },
            close(){
                this.disabled = false;
                this.$emit("on-close",true)
            }
        }
    }
</script>

<style lang="scss">
    .channelListDialog{
        .el-dialog__footer{
            border-top: 1px solid rgba(0, 0, 0, 0.06);
        }
    }
</style>